#ifndef __HELPER_H__
#define __HELPER_H__

#include <avr/pgmspace.h>
#include <avr/interrupt.h>
#include <util/delay.h>
#include <avr/sleep.h>

#include "portdef.h"
#include "limit_switch.h"

/*******************************************************************/

typedef struct {
	#ifdef FULLSTEP
	unsigned iStep:2;
	#else
	unsigned iStep:3;
	#endif
	unsigned iMotor:2;	// Pin for ENABLE on L293D
	unsigned iSwitch:3;	// Pin for END limit switch
	int16_t  Pos;		// Position
	int16_t	 maxSteps;
} sAxis;				// 20 Bit


// Available axis. Initialization must be done in main ()

sAxis Axis[3];	// 3x20b = 60b

#define X	Axis[0]
#define	Y	Axis[1]
#define Z	Axis[2]

#define MARGIN 20

volatile uint8_t mindelay;

/*******************************************************************/

void putpixel(int16_t newX, int16_t newY, int16_t newZ);

void _dummyMove(uint8_t CurAxis);

void initialize();

void Mot_plus(uint8_t curAxis);
void Mot_minus(uint8_t curAxis);

#endif
